// pages/band/sq/index.js
const App = getApp();
Component({
  /**
   * 组件的属性列表
   */
  properties: {

  },

  /**
   * 组件的初始数据
   */
  data: {
    real_name:'',
    mobile:''
  },

  /**
   * 组件的方法列表
   */
  methods: {
    userNameInputAction (options) {
      //获取输入框输入的内容
      let value = options.detail.value;
      this.setData({
        real_name:value
      })
      console.log("输入框输入的内容是 " + value)
    },

    userPhoneInputAction (options) {
      //获取输入框输入的内容
      let value = options.detail.value;
      this.setData({
        mobile:value
      })
      console.log("输入框输入的内容是 " + value)
    },
    submitBtn(){
      
      let _this = this;
      console.log(_this.data.real_name,_this.data.mobile)
      App._get('user/member', {
        real_name:_this.data.real_name,
        mobile:_this.data.mobile
      }, function (result) {
        _this.setData(result.data);
        wx.switchTab({
          url: '/pages/index/index',
        })
      });
    },
    getPhone(e){
      let _this = this;
      wx.login({
        success: (res) => {
          App._post_form("user/getPhone", {
            code: e.detail.code
          }, (res) => {
            wx.showToast({
              title: '绑定成功',
            })
            _this.setData({
              mobile:res.data.phone
            })
          })
        }
      })
    console.log(e);
      // App._get('user/getPhone', {},function(res){
      //   console.log(res)
      // })
     
    }
  }
})
